﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using User.EF.Contracts;

namespace User.Web.Models.Admin
{
    /// <summary>
    /// Standard Model für die aktuelle Seite
    /// </summary>
    public class MemberRightModel : ModelBase
    {
        #region Member
        /// <summary>
        /// Der Aktuelle Benutzername
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// Die aktuelle UserId für die die Rechte angezeigt werden.
        /// </summary>
        public long UserId { get; set; }
        #endregion

        #region Public Functions

        public void Load(IWebQuerySummary query, long userId)
        {
            UserId = userId;
            UserName = string.Empty;

            var member = query.MembershipQueries.GetMemberById(userId);
            if (member != null)
            {
                UserName = member.ToString();
            }
        }
        #endregion
    }
}
